home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2.sit
/
Raven 1.2
/
Source
/
Foundation
/
OS
/
ZDialogUtils.h
< prev
next >
Wrap
Text File
|
1997-08-07
|
4KB
|
111 lines
/*
* File: ZDialogUtils.h
* Summary: Handy dialog manager related routines.
* Written by: Jesse Jones
*
* Copyright ゥ 1996-1997 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <2> 8/05/97 JDJ DoNote, DoCaution, and DoStop use StandardAlert in OS 8.
* Added DoSave and DoRevert.
* <1> 5/06/96 JDJ Created
*/
#pragma once
#include <Dialogs.h>
#include <String.h>
#include <ZGeometry.h>
#include <ZTypes.h>
//-----------------------------------
// Constants
//
const ResID kMessageDlogID = 130;
const ResID kSaveChangesAlert = 131;
const ResID kConfirmRevertAlert = 133;
const short kSaveBtn = 1;
const short kCancelBtn = 2;
const short kDontSaveBtn = 3;
// ===================================================================================
// Standard Filter
// ===================================================================================
pascal Boolean DefaultFilter(DialogPtr dptr, EventRecord* event, short* item);
// Default dialog filter. Walks a list of filters until one of them handles the
// event.
pascal Boolean DefaultYDFilter(DialogPtr dptr, EventRecord* event, short* item, void* myData);
// Default standard file dialog filter. Walks a list of filters until one of
// them handles the event.
void AddDialogFilter(ModalFilterProcPtr filter);
// Adds a new dialog filter to be executed by DefaultFilter. Called by higher
// level components of Raven to, for example, allow windows to be updated.
pascal Boolean DefaultFilterProc(DialogPtr dptr, EventRecord* event, short* item);
// The dialog filter DefaultFilter starts with. Outlines the default
// button, handles cut/copy/paste, changes the cursor to an i-beam,
// and handles return/escape/etc.
pascal Boolean SaveChangesFilter(DialogPtr dptr, EventRecord* event, short* item);
// Used by DoSave.
// ===================================================================================
// Alerts
// ===================================================================================
short DoAlert(ResID id, ModalFilterProcPtr filter = DefaultFilter);
short DoNote(const string& errorStr, const string& supplementalStr, ResID id = kMessageDlogID, ModalFilterProcPtr filter = DefaultFilter);
// Under OS 8 StandardAlert is used so errorStr appears in bold and id is
// ignored.
short DoCaution(const string& errorStr, const string& supplementalStr, ResID id = kMessageDlogID, ModalFilterProcPtr filter = DefaultFilter);
short DoStop(const string& errorStr, const string& supplementalStr, ResID id = kMessageDlogID, ModalFilterProcPtr filter = DefaultFilter);
short DoSave(const string& fileName, ModalFilterProcPtr filter = SaveChangesFilter);
// Returns kSaveBtn, kCancelBtn, or kDontSaveBtn.
bool DoRevert(const string& fileName, ModalFilterProcPtr filter = DefaultFilter);
// Returns true if the file should be reverted.
// ===================================================================================
// Accessors
// ===================================================================================
TRect GetItemBounds(DialogPtr dialog, short item);
short GetItemType(DialogPtr dialog, short item);
bool ItemIsEnabled(DialogPtr dialog, short item);
ControlHandle GetControl(DialogPtr dialog, short item);
string GetDStr(DialogPtr dialog, short item);
// ===================================================================================
// User Procs
// ===================================================================================
void SetUserProc(DialogPtr dialog, short item, UserItemUPP userProc);
// Sets the draw proc for a user item.
void SetDashedLineProc(DialogPtr dialog, short item);
void SetDrawPictProc(DialogPtr dialog, short item, PicHandle* pict);
// Note that this will not work with multiple picts in a single dialog.
// ===================================================================================
// Misc
// ===================================================================================
void SetDStr(DialogPtr dialog, short item, const string& str);
void FlashButton(DialogPtr dialog, short item);
// Call this when a button is pressed via a keystroke.